package com.ruoyi.crm.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.crm.domain.CrmProduct;
import com.ruoyi.crm.mapper.CrmProductMapper;
import com.ruoyi.crm.service.ICrmProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 产品Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-03-30
 */
@Service
public class CrmProductServiceImpl implements ICrmProductService
{
    @Autowired
    private CrmProductMapper crmProductMapper;

    /**
     * 查询产品
     * 
     * @param id 产品ID
     * @return 产品
     */
    @Override
    public CrmProduct selectCrmProductById(Long id)
    {
    	return crmProductMapper.selectCrmProductById(id);
    }

    /**
     * 查询产品列表
     * 
     * @param crmProduct 产品
     * @return 产品
     */
    @Override
    public List<CrmProduct> selectCrmProductList(CrmProduct crmProduct)
    {
        return crmProductMapper.selectCrmProductList(crmProduct);
    }

    /**
     * 新增产品
     * 
     * @param crmProduct 产品
     * @return 结果
     */
    @Override
    public Integer insertCrmProduct(CrmProduct crmProduct)
    {
        crmProduct.setCreateTime(DateUtils.getNowDate());
        return crmProductMapper.insertCrmProduct(crmProduct);
    }

    /**
     * 修改产品
     * 
     * @param crmProduct 产品
     * @return 结果
     */
    @Override
    public Integer updateCrmProduct(CrmProduct crmProduct)
    {
        crmProduct.setUpdateTime(DateUtils.getNowDate());
        return crmProductMapper.updateCrmProduct(crmProduct);
    }

    /**
     * 批量删除产品
     * 
     * @param ids 需要删除的产品ID
     * @return 结果
     */
    @Override
    public int deleteCrmProductByIds(Long[] ids)
    {
        return crmProductMapper.deleteCrmProductByIds(ids);
    }

    /**
     * 删除产品信息
     * 
     * @param id 产品ID
     * @return 结果
     */
    @Override
    public Integer deleteCrmProductById(Long id)
    {
        return crmProductMapper.deleteCrmProductById(id);
    }
}
